<template>
	<view class="xc-block">
		<view class="xc-title">{{sr.paper.cfgresultmsg}}</view>
		<uv-image :src="sr.paper.cfgresultmsgimage"
			v-if="sr.paper.cfgresultmsgimage!=null && sr.paper.cfgresultmsgimage!=''" width="100%" mode="widthFix">
		</uv-image>

		<uv-button class="xc-pt" type="primary" v-if="sr.paper.cfgmaxanswercount > sr.usercount" @click="control_clickAgain">
			{{$t('xp.paper.btn_answer_again')}}
		</uv-button>
	</view>
</template>
<script>
	import config from "@/config/config.js";
	import xcHttpUtils from '@/library/xcore/js/XcHttpUtils.js';
	import xcViewUtils from '@/library/xcore/js/XcViewUtils.js';
	import {
		xsStringUtils,
		xsDateUtils,
		xsArrayUtils
	} from 'xstack-for-javascript';

	export default {
		props: {
			data: {
				type: Object,
				default: []
			}
		},
		watch: {
			'data': {
				handler(newVal, oldVal) {
					let that = this;
					that.public_show();
				},
			},
		},
		emits:['reset_parent'],
		data() {
			return {
				config: config,
				xsStringUtils: xsStringUtils,
				xsDateUtils: xsDateUtils,
				sp: {},
				sr: {
					paper: [],
					usercount: 0,
				},
				control: {}
			}
		},
		created() {
			let that = this;
			that.xinit();
			that.public_show();
		},
		methods: {
			xinit() {
				let that = this;
			},
			public_show() {
				let that = this;
				that.sr.paper = that.data.paper;
				that.sr.usercount = that.data.usercount;
			},
			public_reset() {
				let that = this;
				that.public_show();
			},
			control_clickAgain() {
				let that = this;
				xcHttpUtils.post('csmwj/xpmy_api/resetuserpage', {
					'id': that.sr.paper.id,
				}, function(res) {
					that.$emit('reset_parent');
				})
			}
		}
	}
</script>

<style lang="scss">

</style>